package com.learn.micro_mall.service.api.goods.impl;

import com.learn.micro_mall.domain.entity.goods.GoodsEntity;
import com.learn.micro_mall.domain.service.goods.GoodsValidatorDomainService;
import com.learn.micro_mall.repository.goods.GoodsRepository;
import com.learn.micro_mall.service.api.goods.GoodsService;
import com.learn.micro_mall.service.convertor.goods.GoodsMapper;
import com.learn.micro_mall.service.request.goods.GoodsCreateRequest;
import com.learn.micro_mall.service.response.goods.GoodsCreateResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/goods")
public class GoodsServiceImpl implements GoodsService {

    @Autowired
    private GoodsValidatorDomainService goodsValidatorDomainService;

    @Resource
    private GoodsRepository goodsRepository;

    @Override
    @RequestMapping("/create")
    public GoodsCreateResponse createGoods(GoodsCreateRequest request) throws Exception {
//        GoodsEntity goodsEntity = GoodsMapper.INSTANCES.toGoodsEntity(request);
//        goodsValidatorDomainService.validGoods(goodsEntity);
//        goodsRepository.insert(goodsEntity);
        return null;
    }
}
